package com.quartz.result;

/**
 * @Author LCXU
 * @Description //返回结果集
 * @Date 10:15 2021/1/15
 */
public class JsonResult {

    private Integer code;
    private String message;
    private Object data;

    private JsonResult(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    private JsonResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public JsonResult(Integer code) {
        this.code = code;
    }

    public static JsonResult success(String message, Object data) {
        return new JsonResult(200, message, data);
    }

    public static JsonResult success(String message) {
        return new JsonResult(200, message);
    }

    public static JsonResult success() {
        return new JsonResult(200);
    }

    public static JsonResult warning(String message){return new JsonResult(201, message);}

    public static JsonResult error() {
        return new JsonResult(500);
    }

    public static JsonResult error(Integer code) {
        return new JsonResult(code);
    }

    public static JsonResult error(Integer code, String message) {
        return new JsonResult(code, message);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}

